/**
 * @description 获取当前时间对应的提示语
 * @returns {String}
 */
export function getTimeState() {
  let timeNow = new Date();
  let hours = timeNow.getHours();
  if (hours >= 6 && hours <= 10) return `早上好 ⛅`;
  if (hours >= 10 && hours <= 14) return `中午好 🌞`;
  if (hours >= 14 && hours <= 18) return `下午好 🌞`;
  if (hours >= 18 && hours <= 24) return `晚上好 🌛`;
  if (hours >= 0 && hours <= 6) return `凌晨好 🌛`;
}

/**
 * @description 获取当前时间的年月日
 * @returns {String}
 */
export function getCurrentDate() {
  let dt = new Date();
  let year = dt.getFullYear();
  let month =
    dt.getMonth() + 1 >= 10 ? dt.getMonth() + 1 : "0" + (dt.getMonth() + 1);
  let day = dt.getDate() >= 10 ? dt.getDate() : "0" + dt.getDate();
  return year + "-" + month + "-" + day;
}
/**
 * @description 获取当前时间星期
 * @returns {String}
 */
export function getCurrentWeek() {
  let dt = new Date();
  let weekDay = [
    "星期日",
    "星期一",
    "星期二",
    "星期三",
    "星期四",
    "星期五",
    "星期六",
  ];
  return weekDay[dt.getDay()];
}

/**
 * @description 获取当前时间
 * @returns {String}
 */

export function getCurrentTime() {
  let dt = new Date();
  let hour = dt.getHours() >= 10 ? dt.getHours() : "0" + dt.getHours();
  let minute = dt.getMinutes() >= 10 ? dt.getMinutes() : "0" + dt.getMinutes();
  let second = dt.getSeconds() >= 10 ? dt.getSeconds() : "0" + dt.getSeconds();
  return hour + ":" + minute + ":" + second;
}

/**
 * @description 图片处理 引入静态资源图片
 * @returns {String}
 */
export function getIcon(url) {
  return new URL(`../assets/${url}`, import.meta.url).href;
}
